package demo.controller;

import demo.controller.form.TestForm;
import demo.error.SysError;
import demo.exception.BizAssert;
import demo.result.Response2Result;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author meilin.huang
 * @date 2022-02-16 3:36 PM
 */
@Response2Result
@RestController
@RequestMapping("/demo/")
public class DemoController {

    @GetMapping("biz-assert")
    public void testNotEmpty(@RequestParam(value = "id", required = false) Integer id) {
        BizAssert.notNull(id, "id不能为空");
        BizAssert.equals(id, 1, SysError.MENU_ERROR);
    }

    @ApiOperation("测试枚举值名称显示")
    @GetMapping("test-swagger-enum")
    public void testEnumUtils(@RequestBody TestForm form) {

    }
}
